import re

s = 'python56 @study65! hard89'
#
result = re.findall(R'\d', s)
print(result)

result = re.findall(R'\W', s)
print(result)

result = re.findall(r'[a-z]', s)
print(result)

# 正则表达式中，不要随意的添加空格
# r = '^[a-z0-9]{6, 9}'
r = '^[a-z0-9]{6,9}$'
result = re.findall(r, '123456789')
print(result)

result = re.findall(r, '@v45a789')
print(result)

# 邮箱规则
r = r'^[\w-]+(\.[\w-]+)*@(qq|gmail|163)(\.[\w-]+)+$'
s = 'a.b.c.d@163.com.c.v'
result = re.match(r, s)
print(result)
print(result.span())
print(result.group())
